package com.myidis.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.myidis.entity.RightUserGroupRole;
import com.myidis.servlet.RightUserGroupRoleServlet;

import io.swagger.annotations.Api;

@Controller
@RequestMapping("/groupRole")
@Api(tags = "用户组包含角色管理接口")
public class RightUserGroupRoleController {
	@Autowired
	private RightUserGroupRoleServlet rightUserGroupRoleServlet;
	
	@ResponseBody
	@RequestMapping("/list")
	public List<RightUserGroupRole> list() {
		return rightUserGroupRoleServlet.all();
	}
	
	@ResponseBody
	@RequestMapping("/entity/{id}")
	public RightUserGroupRole one(@PathVariable int id) {
		return rightUserGroupRoleServlet.getOne(id);
	}
	
	@ResponseBody
	@RequestMapping("/add")
	public int add(@RequestBody List<RightUserGroupRole> rightUserGroupRoles) {
		return rightUserGroupRoleServlet.insert(rightUserGroupRoles);
	}
	
	@ResponseBody
	@RequestMapping("/upd")
	public int upd(@RequestBody RightUserGroupRole rightUserGroupRole) {
		return rightUserGroupRoleServlet.update(rightUserGroupRole);
	}

	@ResponseBody
	@RequestMapping("/del")
	public int del(@RequestBody int[] ids) {
		return rightUserGroupRoleServlet.delete(ids);
	}
}
